package cn.mynb.util;

import java.util.UUID;

public class PicExtValidate {
	
	/**
	 * 判断上传的图片，是否符合
	 * @param picName
	 * @return
	 */
	public static boolean ext(String picName) {
		String ext = picName.substring(picName.lastIndexOf(".")+1) ;
		String[] extTemp = new String[]{"jpg","jpeg","gif","png","bmp"} ;
		
		for(int i=0;i<extTemp.length;i++) {
			if(extTemp[i].equalsIgnoreCase(ext)) {
				return true ;
			}
		}
		return false ;
	}
	
	public static String rename(String name) {
		return UUID.randomUUID().toString()+name.substring(name.lastIndexOf(".")) ;
	}
}
